package cqut.wys;

import org.springframework.shell.standard.ShellComponent;
import org.springframework.shell.standard.ShellMethod;
import org.springframework.shell.standard.ShellOption;

/**
 * --------神兽出没--------/
 * ┌─┐     ┌─┐
 * ┌─┘─┴─────┘─┴─┐
 * │      ─      │
 * │  ┬─┘   └─┬  │
 * │             │
 * │      ┴      │  Code is far away from bug with the animal protecting
 * └───┐      ┌──┘  神兽保佑,代码无bug
 * │      │
 * │      └──────┐
 * │             ├┐
 * │             ┌┘
 * └┐ ┐ ┌───┬─┐ ┌┘
 * │ ┤ ┤   │ ┤ ┤
 * └─┴─┘   └─┴─┘
 * --------感觉萌萌哒--------/
 *
 * @author wys
 * @date 2018/12/7.
 */
@ShellComponent
public class HelloCommand {

    @ShellMethod("Say hi")
    public String sayHi(String name) {
        return String.format("Hi %s", name);
    }

    @ShellMethod(value = "Add numbers.", key = "sum")
    public int add(int a, int b) {
        return a + b;
    }

    @ShellMethod("Display stuff.")
    public String echo(int a, int b, int c) {
        return String.format("You said a=%d, b=%d, c=%d", a, b, c);
    }

    @ShellMethod("Say hello.")
    public String greet(@ShellOption(defaultValue="World") String who) {
        return "Hello " + who;
    }

}
